package com.meida.module.bus.provider.utils;

import com.meida.common.base.utils.FlymeUtils;
import org.apache.commons.beanutils.ConvertUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class MyUtils {
    /**
     * 以逗号分隔的转换成list
     */
    public static List<String> stringToList(String str) {
        List<String> list = new ArrayList();
        if (FlymeUtils.isNotEmpty(str)) {
            String[] temp = str.split(",");
            list = Arrays.asList(temp);
        }
        return list;
    }

    /**
     * 以逗号分隔的转换成list
     */
    public static List<Long> stringToLongList(String str) {
        List<Long> list = new ArrayList();
        if (FlymeUtils.isNotEmpty(str)) {
            String[] temp = str.split(",");
            Long[] convert = (Long[]) ConvertUtils.convert(temp, Long.class);
            list = Arrays.asList(convert);
        }
        return list;
    }
}
